<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/26
 * Time: 19:48
 */
$pdo=new PDO("mysql:dbname=test0925;host=127.0.0.1","root","");
$pdo->exec("SET NAMES 'utf8'");

$sql="SELECT * FROM dc_comment";

$res=$pdo->query($sql);

echo "<table border='1'>";

echo "<tr>
<th>编号</th>
<th>用户编号</th>
<th>评论</th>
<th>评论时间</th>
</tr>";

foreach ($res as $comment)
{
    echo "<tr>";

    echo "<td>{$comment['id']}</td>";
    echo "<td>{$comment['user_id']}</td>";
    echo "<td>{$comment['content']}</td>";
    echo "<td>{$comment['create_time']}</td>";

    echo "</tr>";
}

echo "</table>";









